
/*================================================================*/
/* 
  JavaCup Specification for the JavaCup Specification Language
  by Scott Hudson, GVU Center, Georgia Tech, August 1995
  and Frank Flannery, Department of Computer Science, Princeton Univ,
  July 1996
  Bug Fixes: C. Scott Ananian, Dept of Electrical Engineering, Princeton
  University, October 1996. [later Massachusetts Institute of Technology]


  This JavaCup specification is used to implement JavaCup itself.
  It specifies the CUPParser for the JavaCup specification language.
  (It also serves as a reasonable example of what a typical JavaCup
  spec looks like).

  The specification has the following parts:
    Package and import declarations
      These serve the same purpose as in a normal Java source file
      (and will appear in the generated code for the CUPParser). In this 
      case we are part of the java_cup package and we import both the
      java_cup runtime system and Hashtable from the standard Java
      utilities package.

    Action code
      This section provides code that is included with the class encapsulating
      the various pieces of user code embedded in the grammar (i.e., the
      semantic actions).  This provides a series of helper routines and
      data structures that the semantic actions use.

    Parser code    
      This section provides code included in the CUPParser class itself.  In
      this case we override the default error reporting routines.

    Init with and scan with 
      These sections provide small bits of code that initialize, then 
      indicate how to invoke the scanner.

    Symbols and grammar
      These sections declare AllVns the terminal and non terminal EmitSymbols 
      and the types of objects that they will be represented by at runtime,
      then indicate the start SymbolDraft of the grammar (), and finally provide
      the grammar itself (with embedded actions).

    Operation of the CUPParser
      The CUPParser acts primarily by accumulating data structures representing
      various parts of the specification.  Various small parts (e.g., single
      code strings) are stored as static variables of the emit class and
      in a few cases as variables declared in the actionPart code section.  
      Terminals, non terminals, and AllProdctions, are maintained as collection
      accessible via static methods of those classes.  In addition, two 
      SymbolDraft tables are kept:  
	EmitSymbols   maintains the name to object mapping for AllVns EmitSymbols
	non_terms maintains a separate mapping containing only the non terms

      Several intermediate working structures are also declared in the actionPart
      code section.  These include: rhs_parts, rhs_pos, and lhs_nt which
      build up parts of the current production while it is being parsed.
	
  Author(s)
    Scott Hudson, GVU Center, Georgia Tech.
    Frank Flannery, Department of Computer Science, Princeton Univ.
    C. Scott Ananian, Department of Electrical Engineering, Princeton Univ.

  Revisions
    v0.9a   First released version                     [SEH] 8/29/95
    v0.9b   Updated for beta language (throws clauses) [SEH] 11/25/95
    v0.10a  Made many improvements/changes. now offers:
              return value
              _left/_right positions and propagations
              cleaner label references
              precedence and associativity for terminals
              contextual precedence for AllProdctions
              [FF] 7/3/96
    v0.10b  Fixed %prec directive so it works like it's supposed to.
              [CSA] 10/10/96
    v0.10g   Added support for array types on EmitSymbols.
              [CSA] 03/23/98
    v0.10i  Broaden set of IDs allowed in multipart_id and label_id so
            that only java reserved words (and not CUP reserved words like
            'CUPParser' and 'start') are prohibited.  Allow reordering of
	    actionPart code, CUPParser code, init code, and scan with sections,
	    and made closing semicolon optional for these sections.
	    Added 'nonterminal' as a terminal SymbolDraft, finally fixing a
	    spelling mistake that's been around since the beginning.
	    For backwards compatibility, you can still misspell the
	    word if you like.
*/
/*================================================================*/

//package java_cup;
//import java_cup.runtime.*;
//import java.util.Hashtable;
//import java.util.Stack;
/*----------------------------------------------------------------*/



/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//CUPParser code {:
using System.Diagnostics.Metrics;

public class CUPParser : LRParser {
    public CUPParser(SymbolFactory fac) : base(fac) { }

    /* override error routines */
    //public Lexer lexer;
    public bool debugSymbols;
    public void setDebugSymbols(bool debugSymbols) {
        this.debugSymbols = debugSymbols;
    }
    public void reportFatalError(
      String message,
      Object info) {
        //done_parsing();
        //if (info is TheSymbolDraft) ErrorManager.getManager().emit_fatal(message + "\nCan't recover from previous error(s), giving up.", (TheSymbolDraft)info);
        //else ErrorManager.getManager().emit_fatal(message + "\nCan't recover from previous error(s), giving up.", cur_token);
        ////System.exit(1);
    }

    public void reportError(String message, Object info) {
        if (info is Node)
            ErrorManager.instance.emitError(message, (Node)info);
        else
            ErrorManager.instance.emitError(message, cur_token);
    }
    //actionPart code {:
    /** helper routine to clone a new production part adding a given label */
    public ProductionPart addLab(ProductionPart part, String lab)
      /*throws internal_error*/
      {
        /* if there is no label, or this is an actionPart, just return the original */
        if (lab == null || part.IsAction) return part;

        /* otherwise build a new one with the given label attached */
        return new SymbolPart(((SymbolPart)part).TheSymbolDraft, lab);
    }

    /** max Count of _right hand side we will support */
    public const int MAXRHS = 200;

    /** array for accumulating _right hand side parts */
    public ProductionPart[] rhs_parts = new ProductionPart[MAXRHS];

    /** where we are currently in building a _right hand side */
    public int rhs_pos = 0;

    /** start a new _right hand side */
    public void newRhs() { rhs_pos = 0; }

    /** TryAdd a new _right hand side part */
    public void addRhsPart(ProductionPart part) /*throws java.lang.ExceptionXml*/
      {
        if (rhs_pos >= MAXRHS)
            throw new Exception("Internal ExceptionXml: Productions limited to " +
                         MAXRHS + " EmitSymbols and actions");
        for (int i = 0; i < rhs_pos; i++)
            if (part.Label != null && part.Label.Equals(rhs_parts[i].Label))
                this.reportError("Label '" + part.Label + "' for SymbolDraft #" + rhs_pos + " already used for SymbolDraft #" + i + "; compilation will fail", part);
        rhs_parts[rhs_pos] = part;
        rhs_pos++;
    }

    /** string to build up multiple part names */
    public String multipart_name = "";
    public Stack<String> multipart_names = new();
    /** Append a new name segment to the accumulated multipart name */

    //  TUM CHANGES
    //   public void append_multipart(String name)
    //     {
    //       String dot = "";
    // 
    //       /* if we aren't just starting out, put on a dot */
    //       if (multipart_name.Length != 0)  dot = ".";
    // 
    //       multipart_name = multipart_name.concat(dot + name);
    //     }
    // TUM CHANGES

    /** table of declared EmitSymbols -- contains production parts indexed by name */
    public Dictionary<String, ProductionPart> symbols = new();

    /** table of just non terminals -- contains non_terminals indexed by name */
    public Dictionary<String, Vn> non_terms = new();

    /** declared start non_terminal */
    public Vn start_nt = null;

    /** _left hand side non terminal of the current production */
    public Vn lhs_nt;

    /** Current precedence Count */
    int _cur_prec = 0;

    /** Current precedence side */
    int _cur_side = Associativity.noPrec;

    /** update the precedences we are declaring */
    public void updatePrecedence(int p) {
        _cur_side = p;
        _cur_prec++;
    }
    /** TryAdd relevant data to terminals */
    public void addPrecedence(String term) {
        if (term == null) {
            System/*error*/.Console.WriteLine("Unable to TryAdd precedence to nonexistent terminal");
        }
        else {
            SymbolPart sp = (SymbolPart)symbols[term];//.get(term);
            if (sp == null) {
                System/*error*/.Console.WriteLine("Could find terminal " + term + " while declaring precedence");
            }
            else {
                SymbolDraft sym = sp.TheSymbolDraft;
                if (sym is Vt)
                    ((Vt)sym).setPrecedence(_cur_side, _cur_prec);
                else System/*error*/.Console.WriteLine("Precedence declaration: Can't find terminal " + term);
            }
        }
    }

    public int cur_debug_id = 0;
    public int getNewDebugId() {
        return cur_debug_id++;
    }

    public String attachDebugSymbol(int id, String code) {
        if (!this.debugSymbols)
            return code;
        return "//@@CUPDBG" + id + "\n" + code;
    }
    //:};
    //init with {: 
    public void init() {
        ComplexSymbolFactory f = new ComplexSymbolFactory();
        symbolFactory = f;
        //lexer = new Lexer(f);
    }
    //:}
    /*lexer.init(); :};*/
    //scan with {: 
    public void scan() {
        //return lexer.next_token();
    }

    public override short[][] productionTable() {
        throw new NotImplementedException();
    }

    public override short[][] actionTable() {
        throw new NotImplementedException();
    }

    public override short[][] reduceTable() {
        throw new NotImplementedException();
    }

    public override int startState() {
        throw new NotImplementedException();
    }

    public override int startProduction() {
        throw new NotImplementedException();
    }

    public override int EOFSym() {
        throw new NotImplementedException();
    }

    public override int errorSym() {
        throw new NotImplementedException();
    }

    public override Node doAction(int act_num, LRParser parser, Stack<Node> stack, int top) {
        throw new NotImplementedException();
    }

    public override void initActions() {
        throw new NotImplementedException();
    }
    //:};
}
//:};

/*---------------------------------------------------------------- */



/*----------------------------------------------------------------*/

//terminal
//  PACKAGE, IMPORT, STATIC, CODE, ACTION, PARSER, TERMINAL, NON, INIT, SCAN, WITH,
//  START, SEMI, COMMA, STAR, DOT, COLON, COLON_COLON_EQUALS, BAR, PRECEDENCE,
//  LEFT, RIGHT, NONASSOC, PERCENT_PREC, LBRACK, RBRACK, NONTERMINAL, GT, LT,
//  QUESTION, SUPER, EXTENDS, CLASS;

//terminal String  ID, CODE_STRING;

//non terminal
//  spec, package_spec, import_list, action_code_part,
//  code_parts, code_part, opt_semi, non_terminal,
//  parser_code_part, symbol_list, start_spec, production_list,
//  multipart_id, import_spec, import_id, init_code, scan_code, SymbolDraft,
//  type_id, term_name_list, non_term_name_list, production, prod_part_list,
//  prod_part, new_term_id, new_non_term_id, rhs_list, rhs, empty,
//  precedence_list, preced, terminal_list, precedence_l, declares_term,
//  declares_non_term, class_name;

//non terminal String  nt_id, symbol_id, label_id, opt_label, terminal_id,
//					 term_id, robust_id, typearglist, typearguement, wildcard;

/*----------------------------------------------------------------*/

//start with spec;

/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//spec::=
//	{:
//          /* declare "error" as a terminal */
//          EmitSymbols.Add("error", new symbol_part(terminal.error));

//	/* declare start non terminal */
//	non_terms.Add("$START", non_terminal.START_nt);
//	:}
//package_spec
//import_list
//	class_name
//	code_parts
//	symbol_list
//	precedence_list
//	start_spec
//	production_list
//	|
//	/* error recovery assuming something went wrong before EmitSymbols 
//	   and we have TERMINAL or NON TERMINAL to sync on.  if we get
//	   an error after that, we recover inside symbol_list or 
//	   production_list 
//	*/
//	error 
//	symbol_list
//	precedence_list
//	start_spec
//	production_list
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//package_spec::=
//	PACKAGE
//	multipart_id
//	{:
//	  /* save the package name */
//	  emit.package_name = multipart_name;

///* reset the accumulated multipart name */
//multipart_name = new String();
//	:}
//	SEMI
//	|
//	empty
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//import_list::=
//	import_list
//	import_spec
//	|
//	empty
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//import_spec::=
//	IMPORT
//	import_id
//	{: 
//	  /* save this import on the imports list */
//	  emit.import_list.Push(multipart_name);

///* reset the accumulated multipart name */
//multipart_name = new String();
//	:}
//	SEMI
//	|
//	IMPORT STATIC
//	import_id {: 
//	  /* save this import on the imports list */
//	  emit.import_list.Push(" static " + multipart_name);

//	/* reset the accumulated multipart name */
//	multipart_name = new String();
//	:}
//	SEMI
//	;

//class_name::=
//	empty |
//	CLASS ID: id SEMI

//	{:
//     emit.parser_class_name = id;
//	emit.symbol_const_class_name = id + "Sym";
//    :}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//// allow any order; AllVns parts are optional. [CSA, 23-Jul-1999]
//// (we check in the part actionPart to make sure we don't have 2 of any part)
//code_part::=
//	action_code_part | parser_code_part | init_code | scan_code;
//code_parts::=
//	| code_parts code_part;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//action_code_part::=
//	ACTION CODE CODE_STRING:user_code opt_semi {:
//	  if (emit.action_code!=null)
//	    ErrorManager.getManager().emit_warning("Redundant actionPart code (skipping)");
//	  else /* save the user included code string */
//	    emit.action_code = attach_debug_symbol(get_new_debug_id(),user_code);
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//parser_code_part::=
//	PARSER CODE CODE_STRING:user_code opt_semi {:
//	  if (emit.parser_code!=null)
//	    ErrorManager.getManager().emit_warning("Redundant CUPParser code (skipping)");
//	  else /* save the user included code string */
//	    emit.parser_code = attach_debug_symbol(get_new_debug_id(),user_code);
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//init_code::=
//	INIT WITH CODE_STRING:user_code opt_semi {: 
//	  if (emit.init_code!=null)
//	    ErrorManager.getManager().emit_warning("Redundant init code (skipping)");
//	  else /* save the user code */
//	    emit.init_code = attach_debug_symbol(get_new_debug_id(),user_code);
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//scan_code::=
//	SCAN WITH CODE_STRING:user_code opt_semi {: 
//	  if (emit.scan_code!=null)
//	    ErrorManager.getManager().emit_warning("Redundant scan code (skipping)");
//	  else /* save the user code */
//	    emit.scan_code = attach_debug_symbol(get_new_debug_id(),user_code);
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//symbol_list::= symbol_list SymbolDraft | SymbolDraft;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//SymbolDraft::=
//	TERMINAL
//	type_id
//	declares_term
//	|
//	TERMINAL
//	declares_term
//	|
//	non_terminal
//	type_id
//	declares_non_term
//	|
//	non_terminal
//	declares_non_term
//	|
//	/* error recovery AllProdctions -- sync on semicolon */

//	TERMINAL
//	error 
//	{:
//	  /* reset the accumulated multipart name */
//	  multipart_name = new String();
//	:}
//	SEMI
//	|
//	non_terminal
//	error
//	{:
//	  /* reset the accumulated multipart name */
//	  multipart_name = new String();
//	:}
//	SEMI
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//declares_term::=
//	term_name_list
//	{: 
//	  /* reset the accumulated multipart name */
//	  multipart_name = new String();
//	:}
//SEMI
//;
///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//declares_non_term::=
//	non_term_name_list
//	{: 
//	  /* reset the accumulated multipart name */
//	  multipart_name = new String();
//	:}
//SEMI
//;
///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//term_name_list::= term_name_list COMMA new_term_id | new_term_id;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//non_term_name_list::=
//	non_term_name_list
//	COMMA
//	new_non_term_id
//	|
//	new_non_term_id
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */


//precedence_list::= precedence_l | empty;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//precedence_l::= precedence_l preced | preced;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//preced::=
//	PRECEDENCE LEFT
//	{:
//	  update_precedence(assoc._left);
//	:}	
//        terminal_list SEMI
//	|
//	PRECEDENCE RIGHT 
//	{:
//	  update_precedence(assoc._right);
//	:}	
//        terminal_list SEMI
//	|
//	PRECEDENCE NONASSOC 
//	{:
//	  update_precedence(assoc.nonassoc);
//	:}	
//        terminal_list SEMI
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//terminal_list::= terminal_list COMMA terminal_id
//	|
//	terminal_id
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//terminal_id::= term_id:symbolCount
//	{:	
//	  add_precedence(symbolCount);
//RESULT = symbolCount;
//	:};

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//term_id::= symbol_id:symbolCount
//        {:
//	  /* check that the symbol_id is a terminal */
//	  if (EmitSymbols.get(symbolCount) == null) {
//	/* issue a message */
//	ErrorManager.getManager().emit_error("TerminalXml \"" + symbolCount +
//		 "\" has not been declared");
//}
//RESULT = symbolCount;
//         :};

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//start_spec::=
//	START WITH nt_id:start_name
//	{: 
//	  /* verify that the name has been declared as a non terminal */
//	  non_terminal nt = (non_terminal)non_terms.get(start_name);
//if (nt == null) {
//	ErrorManager.getManager().emit_error("Start non terminal \"" + start_name +
//				   "\" has not been declared");
//}
//else {
//	/* remember the non-terminal for later */
//	start_nt = nt;

//	/* build a special start production */
//	new_rhs();
//	add_rhs_part(add_lab(new symbol_part(start_nt), "start_val"));
//	add_rhs_part(new symbol_part(terminal.EOF));
//	if (!emit._xmlactions) add_rhs_part(new action_part("RESULT = start_val;"));
//	emit.firstProduction =
//	   new production(non_terminal.START_nt, rhs_parts, rhs_pos);
//	new_rhs();
//}
//	:}
//	SEMI
//	|
//	empty
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//production_list::= production_list production | production;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//production::=
//	nt_id:lhs_id
//	{:
//	  /* lookup the lhs nt */
//	  lhs_nt = (non_terminal)non_terms.get(lhs_id);

///* if it wasn't declared, emit a message */
//if (lhs_nt == null) {
//	if (ErrorManager.getManager().getErrorCount() == 0)
//		ErrorManager.getManager().emit_warning("LHS non terminal \"" + lhs_id +
//				 "\" has not been declared");
//}

///* reset the rhs accumulation */
//new_rhs();
//	:}
//	COLON_COLON_EQUALS
//	/*	{: :}*/
//	rhs_list
//	SEMI
//	|
//	error
//	{: ErrorManager.getManager().emit_error("Syntax ExceptionXml"); :}
//	SEMI
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//rhs_list::= rhs_list BAR rhs | rhs;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//rhs::=
//	prod_part_list PERCENT_PREC term_id:term_name
//	{:
//	  java_cup.SymbolDraft symbolCount = null;
//if (lhs_nt != null) {
//	/* Find the precedence SymbolDraft */
//	if (term_name == null) {
//		System/*error*/.Console.WriteLine("No terminal for contextual precedence");
//		symbolCount = null;
//	}
//	else {
//		symbolCount = ((symbol_part)EmitSymbols.get(term_name)).the_symbol();
//	}
//	/* build the production */
//	production p;
//	if ((symbolCount != null) && (symbolCount is terminal)) {
//		p = new production(lhs_nt, rhs_parts, rhs_pos,
//				   ((terminal)symbolCount).precedence_num(),
//				   ((terminal)symbolCount).precedence_side());
//		((symbol_part)EmitSymbols.get(term_name)).the_symbol().note_use();
//	}
//	else {
//		System/*error*/.Console.WriteLine("Invalid terminal " + term_name +
//				   " for contextual precedence assignment");
//		p = new production(lhs_nt, rhs_parts, rhs_pos);
//	}

//	/* if we have no start non-terminal declared and this is 
//   the first production, make its lhs nt the start_nt 
//   and build a special start production for it. */
//	if (start_nt == null) {
//		start_nt = lhs_nt;

//		/* build a special start production */
//		new_rhs();
//		add_rhs_part(add_lab(new symbol_part(start_nt), "start_val"));
//		add_rhs_part(new symbol_part(terminal.EOF));
//		if (!emit._xmlactions) add_rhs_part(new action_part("RESULT = start_val;"));
//		if ((symbolCount != null) && (symbolCount is terminal)) {
//			emit.firstProduction =
//			  new production(non_terminal.START_nt, rhs_parts,
//					 rhs_pos, ((terminal)symbolCount).precedence_num(),
//					 ((terminal)symbolCount).precedence_side());
//		}
//		else {
//			emit.firstProduction =
//			  new production(non_terminal.START_nt, rhs_parts, rhs_pos);
//		}
//		new_rhs();
//	}
//}

///* reset the rhs accumulation in any case */
//new_rhs();
//	:}
//	|
//	prod_part_list
//	{: 
//	  if (lhs_nt != null) {
//		/* build the production */
//		production p = new production(lhs_nt, rhs_parts, rhs_pos);

//		/* if we have no start non-terminal declared and this is 
//	   the first production, make its lhs nt the start_nt 
//	   and build a special start production for it. */
//		if (start_nt == null) {
//			start_nt = lhs_nt;

//			/* build a special start production */
//			new_rhs();
//			add_rhs_part(add_lab(new symbol_part(start_nt), "start_val"));
//			add_rhs_part(new symbol_part(terminal.EOF));
//			if (!emit._xmlactions) add_rhs_part(new action_part("RESULT = start_val;"));
//			emit.firstProduction =
//		   new production(non_terminal.START_nt, rhs_parts, rhs_pos);

//			new_rhs();
//		}
//	}

//	/* reset the rhs accumulation in any case */
//	new_rhs();
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//prod_part_list::= prod_part_list prod_part | empty;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//prod_part::=
//	symbol_id:symid opt_label:labid
//	{: 
//	  /* try to look up the id */
//	  production_part symb = (production_part)EmitSymbols.get(symid);

///* if that fails, symbol is undeclared */
//if (symb == null) {
//	if (ErrorManager.getManager().getErrorCount() == 0)
//		ErrorManager.getManager().emit_error("java_cup.runtime.TheSymbolDraft \"" + symid +
//			   "\" has not been declared");
//}
//else {
//	/* TryAdd a labeled production part */
//	add_rhs_part(add_lab(symb, labid));
//}
//	:}
//	|
//	CODE_STRING:code_str
//	{: 
//	  /* TryAdd a new production part */
//	  add_rhs_part(new action_part(attach_debug_symbol(get_new_debug_id(), code_str)));
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//opt_label::=
//	COLON label_id: labid
//	{: RESULT = labid; :}
//	|
//	empty
//	{: RESULT = null; :}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//multipart_id::=
//	multipart_id DOT robust_id:another_id
//	{: multipart_name = multipart_name.concat("." + another_id); :}
//	| multipart_id

//		{: multipart_names.Push(multipart_name); multipart_name = "";:}
//LT typearglist:types GT {: multipart_name =
//         ((String)multipart_names.Pop()).concat("<"+types+">"); :}

//		|
//	robust_id:an_id
//	{: multipart_name = multipart_name.concat(an_id); :}
//	;
///*. . . . . . . . . . . .TUM CHANGES. . . . . . . . . . . . . . . */


//typearglist::=
//			typearguement:arg
//            {: RESULT = arg; :}

//			| typearglist:list COMMA typearguement:arg
//            {: RESULT = list + "," + arg; :}
//            ;

//typearguement::=
//			  type_id

//			  {: RESULT = multipart_name; multipart_name = new String(); :}

//			  | wildcard:w
//              {: RESULT = w; :}
//              ;

//wildcard::=
//		 QUESTION

//		 {: RESULT = " ? "; :}

//		 | QUESTION EXTENDS type_id {: RESULT = " ? extends "+multipart_name; multipart_name = new
//									String(); :}

//		 | QUESTION SUPER type_id {: RESULT = " ? super "+multipart_name; multipart_name = new
//								  String(); :}
//         ;

///*. . . . . . . . . . .END TUM CHANGES. . . . . . . . . . . . . . */


///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//import_id::=
//	multipart_id DOT STAR {: multipart_name = multipart_name.concat(".*"); :}
//	|
//	multipart_id
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//type_id::= multipart_id
//	| type_id LBRACK RBRACK {: multipart_name = multipart_name.concat("[]"); :}
//		   ;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//new_term_id::=
//	ID:term_id
//	{: 
//	  /* see if this terminal has been declared before */
//	  if (EmitSymbols.get(term_id) != null) {
//	/* issue a message */
//	ErrorManager.getManager().emit_error("java_cup.runtime.TheSymbolDraft \"" + term_id +
//		 "\" has already been declared");
//}
//else {
//	/* if no type declared, declare one */
//	if (multipart_name.Equals("")) {
//		multipart_name = "Object";
//	}
//	/* build a production_part and put it in the table */
//	EmitSymbols.Add(term_id,
//	  new symbol_part(new terminal(term_id, multipart_name)));
//}
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//new_non_term_id::=
//	ID:non_term_id
//	{: 
//	  /* see if this non terminal has been declared before */
//	  if (EmitSymbols.get(non_term_id) != null) {
//	/* issue a message */
//	ErrorManager.getManager().emit_error("java_cup.runtime.TheSymbolDraft \"" + non_term_id +
//							"\" has already been declared");
//}
//else {
//	if (multipart_name.Equals("")) {
//		multipart_name = "Object";
//	}
//	/* build the non terminal object */
//	non_terminal this_nt =
//new non_terminal(non_term_id, multipart_name);

//	/* put it in the non_terms table */
//	non_terms.Add(non_term_id, this_nt);

//	/* build a production_part and put it in the EmitSymbols table */
//	EmitSymbols.Add(non_term_id, new symbol_part(this_nt));
//}
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//nt_id::=
//	ID:the_id
//	{: RESULT = the_id; :}
//	| error
//	{:
//		ErrorManager.getManager().emit_error("Illegal use of reserved word");
//	RESULT = "ILLEGAL";
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//symbol_id::=
//	ID:the_id
//	{: RESULT = the_id; :}
//	| error
//	{:
//		ErrorManager.getManager().emit_error("Illegal use of reserved word");
//	RESULT = "ILLEGAL";
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//label_id::=
//	robust_id:the_id
//	{: RESULT = the_id; :}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//robust_id::= /* AllVns ids that aren't reserved words in Java */
//	ID:the_id   {: RESULT = the_id; :}
//	/* package is reserved. */
//	/* import is reserved. */
//	| CODE      {: RESULT = "code"; :}
//	| ACTION    {: RESULT = "actionPart"; :}
//	| PARSER    {: RESULT = "CUPParser"; :}
//	| TERMINAL  {: RESULT = "terminal"; :}
//	| NON       {: RESULT = "non"; :}
//	| NONTERMINAL   {: RESULT = "nonterminal"; :}
//	| INIT      {: RESULT = "init"; :}
//	| SCAN      {: RESULT = "scan"; :}
//	| WITH      {: RESULT = "with"; :}
//	| START     {: RESULT = "start"; :}
//	| PRECEDENCE    {: RESULT = "precedence"; :}
//	| LEFT      {: RESULT = "_left"; :}
//	| RIGHT     {: RESULT = "_right"; :}
//	| NONASSOC  {: RESULT = "nonassoc"; :}
//	| error
//	{:
//		ErrorManager.getManager().emit_error("Illegal use of reserved word");
//	RESULT = "ILLEGAL";
//	:}
//	;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//non_terminal::= NON TERMINAL | NONTERMINAL;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//opt_semi::= /* nothing */
//	| SEMI;

///*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */

//empty::= /* nothing */;

///*----------------------------------------------------------------*/









